﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace GameName1
{
    internal class BonusAlienExplosion : GameObject, IDisplayable
    {
        private static SpriteFont _font;

        private double _createdTime;
        private double _lastFrame;

        public BonusAlienExplosion(Vector2 position, GameTime gameTime) : base(position)
        {
            _createdTime = gameTime.TotalGameTime.TotalMilliseconds;
        }

        public override void Update(GameTime gameTime)
        {
            if (gameTime.TotalGameTime.TotalMilliseconds > _lastFrame + 30)
            {
                Position -= new Vector2(0,1);
                _lastFrame = gameTime.TotalGameTime.TotalMilliseconds;
            }
            if (gameTime.TotalGameTime.TotalMilliseconds > _createdTime + 500)
                GameObjectsManager.GetInstance().Destroy(this);
        }       
        public static void LoadContent(ContentManager contentManager)
        {
            _font = contentManager.Load<SpriteFont>("myfont");
        }

        public int DrawingOrder { get { return 0; } }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.DrawString(_font,"200",Position,Color.White);
        }
    }
}
